package cn.sh.yhk;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.web.bind.annotation.GetMapping;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
//import org.springframework.jms.annotation.EnableJms;

@SpringBootApplication
@ServletComponentScan
//@EnableRedisHttpSession
//@EnableJms
@EnableCaching
@EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class})
public class Application {

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }

    @GetMapping("/hello_world_mono")
    public Mono<String> helloWorld() {
        return Mono.just("Hello World with flux's mono");
    }

    @GetMapping("/hello_world_flux")
    public Flux<String> helloWorldFlux() {
        return Flux.just("Hello", "World");
    }
//    @JmsListener(destination = "YYHK")
//    public String receiveQueue(String text) {
//        return ("Consumer-A : 收到的报文为:" + text);
//    }

//    @JmsListener(destination = "asa")
//    public void receiveMsg(String text) {
//        System.out.println("<<<<<<============ 收到消息： " + text);
//    }
//
//    @Bean
//    JmsListenerContainerFactory<?> myJmsContainerFactory(ConnectionFactory connectionFactory) {
//        SimpleJmsListenerContainerFactory factory = new SimpleJmsListenerContainerFactory();
//        factory.setConnectionFactory(connectionFactory);
//        factory.setPubSubDomain(true);
//        return factory;
//    }

    //  @KafkaListener(topics = {"test"})
    //  public void listen(ConsumerRecord<?, ?> record) {
    //     System.out.println("接收消息为:"+record.value());
//}


//各种JVM参数
//-Dspring.profiles.active=dev

}
